<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>particles.js</title>
  <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
  <meta name="author" content="Vincent Garreau">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <link rel="stylesheet" media="screen" href="static/css/login.css">
  <script src="jquery.min.js"></script>
</head>
<body>
<!-- particles.js container -->
<div id="particles-js" style="display: flex;align-items: center;justify-content: center">
</div>
<div class="login-page">
   <div class="login-content">
     <div class="login-tit">登录</div>
     <div class="login-input">
       <input type="text" id="uid" placeholder="用户名/手机号">
     </div>
     <div class="login-input">
      <input type="password" id="pwd" placeholder="密码">
    </div>
    <div class="login-btn">
      <div class="login-btn-left" id=“denglu” onclick="change()">
        <span>登录</span>
      </div>
      <div class="login-btn-left" onclick="zhuce()">
          <span>注册</span>
      </div>
      <div class="login-btn-right" onclick="changeImg()">
        <img src="static/picture/check.png" alt="" id="picture"> 记住密码
      </div>
    </div>
   </div>
</div>


<!-- scripts -->
<script src="static/js/particles.js"></script>
<script src="static/js/app.js"></script>
<script>
  function changeImg(){
    let pic = document.getElementById('picture');
    console.log(pic.src)
    if(pic.getAttribute("src",2) =="img/check.png"){
      pic.src ="img/checked.png"
    }else{
      pic.src ="img/check.png"
    }
  }

  function change(){
      // var triangle = document.getElementById("login-btn-left");
      // var a = document.getElementById("form_a");
      // if(triangle.className==="triangle1"){
      //     triangle.className="triangle2";
      //     a.style="display: block";
      // }else{
      //     triangle.className="triangle1";
      //     a.style="display: none";
      // }
      // window.location.href="h2.html"



      var uid = $("#uid").val();
      var pwd = $("#pwd").val();
      var data= {
          data: JSON.stringify({
              'username': uid,
              'password': pwd
          }),
      }
      $.ajax({

          url:"http://0.0.0.0:5000/login",

          data:data,

          type:"POST",
          
          dataType: 'json',
          success:function(res){
            console.log(res.type)

              if(res.type=='1'){
                // window.location.href="h2.html"; 
                // alert('ok')
                window.location.href="1/index.html";
              }else{
                alert('用户名与密码不匹配');
              };

          },
          error:function (res) {
              console.log(res)
              console.log(1)
              alert('000000')
          }
          
          },

      );

  }

  function zhuce(){
    window.location.href='xc/index.html';

  }

</script>


</body>
</html>